//
//  Config.h
//  HappyTravel
//
//  Created by Apple on 2018/8/2.
//  Copyright © 2018年 Apple. All rights reserved.
//

#ifndef Config_h
#define Config_h

#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
#define randomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define COLOR_RGB(_R, _G, _B) [UIColor colorWithRed:_R / 255.0 green:_G / 255.0 blue:_B / 255.0 alpha:1.0f]
#define COLOR_RGB_A(_R, _G, _B, _A) [UIColor colorWithRed:_R / 255.0 green:_G / 255.0 blue:_B / 255.0 alpha:_A]
#define UIColorOfHex(s) [UIColor colorWithRed:(((s & 0xFF0000) >> 16))/255.0 green:(((s & 0xFF00) >> 8))/255.0 blue:((s & 0xFF))/255.0  alpha:1]
#define ThemeColor  UIColorOfHex(0x41B987)
#define TextColor   COLOR_RGB(255, 75, 0)

#define ScreenWidth   [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight  [[UIScreen mainScreen] bounds].size.height
#define SCAlE_WIDTH   [UIScreen mainScreen].bounds.size.width/320.0
#define SCAlE_HEIGHT  [UIScreen mainScreen].bounds.size.height/568.0


//判断iOS11版本
#define IOS_VERSION_11 @available(iOS 11.0, *)
//判断iPhoneX
#define IsIPhoneX CGRectEqualToRect([UIScreen mainScreen].bounds,CGRectMake(0, 0, 375, 812))
//Status bar height.
#define StatusBarHeight      (IsIPhoneX ? 44.f : 20.f)
//Navigation bar height.
#define NavigationBarHeight  44.f
//Tabbar height.
#define TabbarHeight         (IsIPhoneX ? (49.f+34.f) : 49.f)
//Tabbar safe bottom margin.
#define TabbarSafeBottomMargin         (IsIPhoneX ? 34.f : 0.f)
//Status bar & navigation bar height.
#define SafeAreaTopHeight (ScreenHeight == 812.0 ? 88 : 64)
//safeAreaInsets
#define ViewSafeAreaInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})


#endif /* Config_h */
